import Vue from "vue";
import Router from "vue-router";

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router);

/* Layout */
import Layout from "@/layout";
// 静态网页
export const constantRouterMap = [{
		path: "/",
		component: Layout,
		children: [{
			path: "",
			name: "homepage",
			component: () => import("@/views/homepage/index"),
			meta: {
				title: "主页",
				icon: "home",
				affix: true
			}
		}]
	},
	{
		path: "/login",
		component: () => import("@/views/login/index"),
		hidden: true
	},
	{
		path: "/404",
		component: Layout,
		hidden: true,
		children: [{
			path: "",
			component: () => import("@/views/404")
		}]
	},
	{
		path: "/user",
		component: Layout,
		meta: {
			title: "用户管理",
			icon: "user"
		},
		children: [{
			path: "userList",
			name: "UserList",
			component: () => import("@/views/user/userList"),
			meta: {
				title: "用户列表",
				icon: "userList"
			}
		}]
	},
	{
		path: "/type",
		component: Layout,
		meta: {
			title: "币种管理",
			icon: "user"
		},
		children: [{
			path: "type",
			name: "Type",
			component: () => import("@/views/type/index"),
			meta: {
				title: "币种管理",
				icon: "auicon"
			}
		}]
	},
	{
		path: "/withdrawal",
		component: Layout,
		meta: {
			title: "提币管理",
			icon: "user"
		},
		children: [{
			path: "withdrawal",
			name: "Withdrawal",
			component: () => import("@/views/withdrawal/index"),
			meta: {
				title: "提币管理",
				icon: "tixian"
			}
		}]
	},
	{
		path: "/meal",
		component: Layout,
		meta: {
			title: "套餐管理",
			icon: "user"
		},
		children: [{
			path: "meal",
			name: "Meal",
			component: () => import("@/views/meal/index"),
			meta: {
				title: "套餐管理",
				icon: "taocan"
			}
		}]
	},

	{
		path: "/strategy",
		component: Layout,
		meta: {
			title: "推荐策略",
			icon: "celue"
		},
		children: [{
			path: "strategy",
			name: "Strategy",
			component: () => import("@/views/strategy/index"),
			meta: {
				title: "推荐策略",
				icon: "celue"
			}
		}]
	},
	{
		path: "/fund",
		component: Layout,
		meta: {
			title: "资讯管理",
			icon: "user"
		},
		children: [{
			path: "fund",
			name: "Fund",
			component: () => import("@/views/fund/index"),
			meta: {
				title: "资讯管理",
				icon: "zixun"
			}
		}]
	},
	{
		path: "/amount",
		component: Layout,
		meta: {
			title: "金额统计",
			icon: "user"
		},
		children: [{
			path: "amount",
			name: "Amount",
			component: () => import("@/views/amount/amount"),
			meta: {
				title: "金额统计",
				icon: "tongji"
			}
		}]
	},
	{
		path: "/set",
		component: Layout,
		meta: {
			title: "APP配置管理",
			icon: "user"
		},
		children: [{
			path: "set",
			name: "Set",
			component: () => import("@/views/set/index"),
			meta: {
				title: "APP配置管理",
				icon: "setting"
			}
		}]
	}
];
export const notFoundRouter = [{
	path: "*",
	redirect: "/404",
	hidden: true
}];
export default new Router({
	// mode: 'history', //后端支持可开
	scrollBehavior: () => ({
		y: 0
	}),
	routes: constantRouterMap
});
